﻿using System;
using Topshelf;

namespace KwaiXiaoDian.Job
{
    class Program
    {
        static void Main(string[] args)
        {
            HostFactory.Run(x =>
            {
                x.Service<MainService>(s =>
                {
                    s.ConstructUsing(name => new MainService());
                    s.WhenStarted((service, control) => service.Start());
                    s.WhenStopped((service, control) => service.Stop());
                });

                x.RunAsLocalSystem();
                x.SetDescription("快小店Job");

                var serviceName = "HuaXun.KwaiXiaoDian.Job";
                x.SetDisplayName(serviceName);
                x.SetServiceName(serviceName);
            });
        }
    }
}
